package com.huawei.spare.part.replace;

import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

public class Constants {

  public static final String ApplicationName = "SparePartReplace";

  public static final int StagePrefWidth = 960;
  public static final int StagePrefHeight = 640;

  public static final double E9000ModelWidth = 367D;
  public static final double E9000ModelHeight = 440D;
  public static final double E9000SlotStartAt = 137D;
  public static final double E9000SlotTopAt = 92D;
  public static final double E9000SlotItemLabelHeight = 32D;
  public static final double SwitchModelWidth = 28.75D;
  public static final double SwitchModelHeight = 310D;

  public static final List<String> SlotNames = Lists.newArrayList("1E", "2X", "3X", "4E");
  public static final ArrayList<Double> SlotRightPos = Lists.newArrayList(165D, 193.75D, 222.5D, 252D);

  public static String UTF8 = "UTF-8";

  // 默认密码
  //    public static final String DefaultPassword = "Huawei12#$";
  //    public static final String DefaultPassword = "Admin@7*24";
  //    public static final String DefaultUsername = "root";
  //    public static final String DefaultHost = "112.93.129.107";

  // database file path
  public static final String FolderDB = "db";
  public static final String FolderTemp = "temp";
  public static final String FolderProject = "projects";

  public static String DbFileSwitch = "switch.xlsx";
  public static String DbFileSolution = "solutions.json";
  public static String DbFileSerialNo = "serial-no.xlsx";
  public static String DbFileInstallPackages = "install-packages.xlsx";
  public static String DbFileVersionMatch = "version-matching-table.xlsx";
  public static String DbFileMeta = "meta.json";
  public static List<String> DbFiles = Lists.newArrayList(DbFileSwitch, DbFileSerialNo, DbFileVersionMatch,
      DbFileInstallPackages, DbFileMeta, DbFileSolution);

  // bundle
  public static final String DefaultBundleName = "bundles/bundle";

  public static final String DefectiveLogFilePath = "osca_log/diag-info.zip";
  public static final String DefectiveLogFileName = "diag-info.txt";
  public static final Pattern BoardTypePatter = Pattern.compile("^3.\\s+Board\\s+Type\\s+:(.*)$", Pattern.MULTILINE);
  public static final Pattern CpldVersionPatter =
      Pattern.compile("^4.\\s+CPLD1\\s+Version\\s+:(.*)$", Pattern.MULTILINE);
  public static final Pattern SoftwareVersionPatter =
      Pattern.compile("^6.\\s+Software\\s+Version\\s+:(.*)$", Pattern.MULTILINE);
  public static final Pattern StackPortPatter =
      Pattern.compile("^Stack-Port\\d/(\\d)\\s+(\\w+/\\d+/\\d)\\s*$", Pattern.MULTILINE);

  // view package
  public static final String ViewPackage = "com.huawei.spare.part.replace.views.";
  public static final String ViewTitlePrefix = "app.title.";

  public static final List<String> BOARD_TYPE_BASE_IGNORE = Lists.newArrayList("CX910", "CX911", "CX912", "CX913");

  public static final String PatternIPV4 =
      "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";

  // Commands
  public static final String PING = "ping -n 5 %s -w 3000";

  /** 3.1.12 查询部件在位信息（ presence）*/
  public static final String SWITCH_IS_PRESENCE = "smmget -l swi%d -d presence";
  public static final String GET_FRU_VERSION = "smmget -l swi%d:fru%d -d version";

  /** 3.9.16 交换配置导出 */
  public static final String SwitchExportConfig = "swiconfexport swi%d";
  /** 3.1.7 控制部件上下电（ powerstate）*/
  public static final String SwitchPowerOff = "smmset -l swi%d:fru%d -d powerstate -v poweroff";
  public static final String SwitchPowerOn = "smmset -l swi%d:fru%d -d powerstate -v poweron";
  // smmset -l swi4:fru1 -d firmwareupdate -v CX910.hpm

  //TMOUT=0
  public static final String ShellReady = "@SMM:/#";
  public static final String ResponseSuccess = "Success";
  public static final String ResponseAskContinue = "Do you want to continue?";
  public static final String ResponseNotExecuted = "The command cannot be executed. The command or parameter is not supported in the current status.";
  public static final String CmdExitInteract = "Interact::exit";




  //
  public static final Pattern PingReached = Pattern.compile("\\d+ms TTL=\\d+$", Pattern.MULTILINE);
}
